diff -urN 5.4.orig/src/zabbix_java/lib/logback.xml 5.4/src/zabbix_java/lib/logback.xml
--- 5.4.orig/src/zabbix_java/lib/logback.xml	2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/lib/logback.xml	2021-02-03 16:08:48.139648517 +0200
@@ -2,10 +2,10 @@
 
 	<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
 
-		<file>/tmp/zabbix_java.log</file>
+		<file>/var/log/zabbix/zabbix_java_gateway.log</file>
 
 		<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
-			<fileNamePattern>/tmp/zabbix_java.log.%i</fileNamePattern>
+			<fileNamePattern>/var/log/zabbix/zabbix_java_gateway.log.%i</fileNamePattern>
 			<minIndex>1</minIndex>
 			<maxIndex>3</maxIndex>
 		</rollingPolicy>
diff -urN 5.4.orig/src/zabbix_java/settings.sh 5.4/src/zabbix_java/settings.sh
--- 5.4.orig/src/zabbix_java/settings.sh	2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/settings.sh	2021-02-03 17:30:37.637881653 +0200
@@ -24,7 +24,7 @@
 # Default:
 # PID_FILE=
 
-PID_FILE="/tmp/zabbix_java.pid"
+PID_FILE="/var/run/zabbix/zabbix_java_gateway.pid"
 
 ### Option: zabbix.startPollers
 #	Number of worker threads to start.
diff -urN 5.4.orig/src/zabbix_java/shutdown.sh 5.4/src/zabbix_java/shutdown.sh
--- 5.4.orig/src/zabbix_java/shutdown.sh	2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/shutdown.sh	2021-02-03 14:54:19.090352858 +0200
@@ -1,7 +1,14 @@
 #!/bin/sh
 
-cd `dirname $0`
-. ./settings.sh
+if [ -r /etc/zabbix/zabbix_java_gateway.conf ]; then
+	. /etc/zabbix/zabbix_java_gateway.conf
+fi
+
+if [ -z $GATEWAY_HOME ]; then
+	GATEWAY_HOME="/usr/share/zabbix_java_gateway"
+fi
+
+cd $GATEWAY_HOME
 
 if [ -n "$PID_FILE" ]; then
 	if [ -f "$PID_FILE" ]; then
diff -urN 5.4.orig/src/zabbix_java/startup.sh 5.4/src/zabbix_java/startup.sh
--- 5.4.orig/src/zabbix_java/startup.sh	2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/startup.sh	2021-02-03 15:51:17.466224873 +0200
@@ -1,7 +1,12 @@
 #!/bin/sh
 
-cd `dirname $0`
-. ./settings.sh
+if [ -r /etc/zabbix/zabbix_java_gateway.conf ]; then
+	. /etc/zabbix/zabbix_java_gateway.conf
+fi
+
+if [ -z $GATEWAY_HOME ]; then
+	GATEWAY_HOME="/usr/share/zabbix_java_gateway"
+fi
 
 if [ -n "$PID_FILE" -a -f "$PID_FILE" ]; then
 	PID=`cat "$PID_FILE"`
@@ -15,9 +20,9 @@
 JAVA=${JAVA:-java}
 
 JAVA_OPTIONS="$JAVA_OPTIONS -server"
-if [ -z "$PID_FILE" ]; then
-	JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=logback-console.xml"
-fi
+JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml"
+
+cd $GATEWAY_HOME
 
 CLASSPATH="lib"
 for jar in lib/*.jar bin/*.jar; do
